package com.ccys.cms.controller.thinkWell;

import com.ccys.cms.service.thinkWell.TblPhqScoringWebService;
import com.ccys.common.constants.ContextConstants;
import com.ccys.common.util.Kit;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.thinkWell.TblPhqScoringDTO;
import com.ccys.db.entity.TblPhqScoring;
import com.ccys.db.vo.thinkWell.TblPhqScoringWebVO;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ApiIgnore
@RestController
@Api(tags = "thinkWell- phq scoring")
@RequestMapping("thinkWell")
@CrossOrigin(methods = {RequestMethod.GET, RequestMethod.POST, RequestMethod.DELETE, RequestMethod.PUT}) // 开启跨域访问允许
@SuppressWarnings("unchecked")
public class PhqScoringWebController {

    @Autowired
    private TblPhqScoringWebService tblPhqScoringWebService;

    @GetMapping("phqScoring")
    @ApiOperation("获取列表")
    @ApiImplicitParams({

            @ApiImplicitParam(name = "phqId", value = "phqId", required = false, dataType = "string", paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 411, message = ContextConstants.DESC_411),
            @ApiResponse(code = 200, message = ContextConstants.MODEL_DESC,response = TblPhqScoringWebVO.class)
    })
    public ResponseResult listObjectsCms(HttpServletRequest request, HttpServletResponse response, @ApiIgnore TblPhqScoringDTO dto) {
        return this.tblPhqScoringWebService.listObjectsCms(request, response, dto);
    }


    @PutMapping("phqScoring")
    @ApiOperation("编辑")
    @ApiResponses({
            @ApiResponse(code = 411, message = ContextConstants.DESC_411),
            @ApiResponse(code = 200, message = ContextConstants.MODEL_DESC)
    })
    public ResponseResult edit(@RequestBody List<TblPhqScoring> entity) {
        return this.tblPhqScoringWebService.change(entity);
    }

}